package com.deep.deepenterprise.api.controller.unit;

import com.deep.deepenterpise.common.result.DrResult;
import com.deep.deepenterpise.model.to.unit.*;
import com.deep.deepenterpise.service.unit.IDrDangerService;
import com.deep.deepenterprise.api.threadlocal.DrLoginTokenContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author xyz
 * @version 1.0
 * @title DrDangerController
 * @description
 * @create 2024/6/23 08:43
 */
@RestController
@RequestMapping("/v12/interface/dr")
public class DrDangerController {

    @Resource
    private IDrDangerService iDrDangerService;

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 随瓶隐患添加
     * @Time 08:45 2024/6/23
     * @Param [drDangerHistoryTo]
     */
    @RequestMapping("/dr-add-danger-history")
    public DrResult drAddDangerHistory(@Validated @RequestBody DrDangerHistoryTo drDangerHistoryTo) {
        String drUserUuid = DrLoginTokenContext.getUserId();
        return iDrDangerService.postAddDangerHistory(drDangerHistoryTo, drUserUuid);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 获取隐患清单列表
     * @Time 11:51 2024/6/24
     * @Param [drDangerPageTo]
     */
    @PostMapping("/dr-check-danger-list")
    public DrResult postDrCheckDangerList(@Valid @RequestBody DrDangerPageTo drDangerPageTo) {
        return iDrDangerService.postDrCheckDangerList(drDangerPageTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 获取待检查列表
     * @Time 10:39 2024/6/25
     * @Param [drDangerSlavePageTo]
     */
    @PostMapping("/dr-wait-check-list")
    public DrResult postDrWaitCheckList(@Valid @RequestBody DrDangerSlavePageTo drDangerSlavePageTo) {
        String drUserUuid = DrLoginTokenContext.getUserId();
        return iDrDangerService.postDrWaitCheckList(drUserUuid, drDangerSlavePageTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 隐患子清单列表
     * @Time 13:22 2024/6/24
     * @Param [drDangerSlavePageTo]
     */
    @PostMapping("/dr-check-danger-slave-list")
    public DrResult postDrCheckDangerSlaveList(@Valid @RequestBody DrDangerSlaveTo drDangerSlaveTo) {
        return iDrDangerService.postDrCheckDangerSlaveList(drDangerSlaveTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 指派检查人员接口
     * @Time 15:02 2024/6/24
     * @Param [drCheckPersonTo]
     */
    @PostMapping("/dr-choose-check-person")
    public DrResult postDrChooseCheckPerson(@Valid @RequestBody DrCheckPersonTo drCheckPersonTo) {
        return iDrDangerService.drChooseCheckPerson(drCheckPersonTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 隐患整改审核
     * @Time 15:27 2024/6/24
     * @Param [drDangerAuditTo]
     */
    @PostMapping("/dr-danger-audit")
    public DrResult postDrDangerAudit(@Valid @RequestBody DrDangerAuditTo drDangerAuditTo) {
        String drUserUuid = DrLoginTokenContext.getUserId();
        return iDrDangerService.postDrDangerAudit(drUserUuid, drDangerAuditTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 隐患修改提交
     * @Time 09:41 2024/6/25
     * @Param [drCheckHousePutTo]
     */
    @PostMapping("/dr-danger-revise-submit")
    public DrResult postDrDangerReviseSubmit(@Valid @RequestBody DrDangerPutTo drDangerPutTo) {
        String drUserUuid = DrLoginTokenContext.getUserId();
        return iDrDangerService.postDrDangerReviseSubmit(drUserUuid, drDangerPutTo);
    }
}
